<template>
  <div class="detail">
    <!-- 从分类到的详情 -->
    <div class="header">
      <!-- 头部首页搜索购物车 -->
      <div class="top flex">
        <div class="home">
          <image class="img" src="../../static/sy.png" mode="widthFix"/>
        </div>
        <div class="yx">网易严选</div>
        <div class="right flex">
          <image class="ss" src="../../static/ss.png" mode="widthFix"/>
          <image class="gwc" src="../../static/gwc.png" mode="widthFix"/>
        </div>
      </div>
      <!-- 滚动试图 -->
      <div class="nav">
        <scroll-view class="list flex" scroll-x  enable-flex>
          <view class="item" v-for="(item,index) in 10" :key="index">{{}}</view>
        </scroll-view>
      </div>
    </div>
    <!-- 从搜索到的详情 -->
    <div>
      
    </div>
    <!-- 身体 -->
    <div class="body">
      <!-- <div class="title">收纳盒</div> -->
      <v-card :list="searchArr.directlyList" ></v-card>
    </div>
  </div>
</template>

<script setup lang="ts">
//引入vue相关
import {ref} from 'vue'
//引入api请求
import {reqSearchResult} from '@/api/index'
//引入uni相关
import {onLoad} from '@dcloudio/uni-app'


//定义响应式数据
//搜索出的数据
let searchArr = ref<any>({})
//输入框的值
let conent = ref<any>('')


//定义方法
//获取点击分类的详情数据
const getCategoryInfo = ()=>{

}

// 获取搜索商品的详情数据
const getGoodsInfo = async ()=>{
  let result = await reqSearchResult(conent.value)
  console.log(result);
  if(result.code==200){
    Object.assign(searchArr.value,result.data)
    console.log(searchArr.value);
  }
}

//生命周期钩子
onLoad((options:any)=>{
  conent.value = options.conent
  getGoodsInfo()
})


</script>

<style scoped lang="less">
.detail{
  width: 100%;
  .header{
    width: 100%;
    /* 头部首页搜索购物车 */ 
  .top{
    width: 100%;
    height: 80rpx;
    border-bottom: 1px solid #ccc ;
    align-items: center;
    .home{
      width: 18%;
      padding: 20rpx;
      .img{
        width: 50rpx;
      }
    }
    .yx{
      width: 60%;
      text-align: center;
      font-weight: 900;
    }
    .right{
      width: 22%;
      justify-content: space-around;
      .ss{
        width: 50rpx;
      }
      .gwc{
        width: 50rpx;
      }
    }
  }
  /* 滚动视图 */
  .nav{
    height: 70rpx;
    line-height: 70rpx;
    overflow: scroll;
    .list{
      width: 3600rpx;
      .item{
        margin: 0 20rpx;
        // border:1px solid #ccc;
      }
    }
  }
  }
}
</style>